import axios from "axios";
import {pushQuestionRequest} from "@/api/questionRequest.js";
axios.defaults.baseURL='http://localhost:8080'
const moduleQuestion={
    namespaced: true,
    state: {
        //由于是一问一答,就用两个数组存,分别依次读取一个元素就可以了
        receiveStatus:false,
        autoAskArray:[],
        questionArray:[],
    },
    actions:{
        pushQuestion(context,question){pushQuestionRequest(context,question)},
    },
    mutations: {
        pushQuestion(state,question){
            if (state.questionArray==null){state.questionArray=[]}
            state.questionArray.push(question)
            console.log(state.questionArray)
        },
        addAnswerContext(state,content){
            state.questionArray[state.questionArray.length-1].content+=content
        }
    }
}
export default moduleQuestion


